const path = require('path');

module.exports = {
    entry: './src/main.js',
    output: {
        filename: 'test.js',
        path: path.resolve(__dirname, 'dist')
    },
    devServer: {
        contentBase: './dist',
        hot: true,
        proxy: {
            '/socialapi': {
                target: 'http://test.raverhub.cn/socialapi',
                changeOrigin: true, //改变源 
                pathRewrite: {
                    '^/socialapi': '' //路径重写 
                }
            },
        }
    },
    mode: 'production',
    // devtool:'inline-source-map',
    // plugins: [
    //     new webpack.NamedModulesPlugin(),
    //     new webpack.HotModuleReplacementPlugin()
    // ],
    module: {
        rules: [
            {
                test: /\.css$/,
                use: ['style-loader', 'css-loader']
            },
            {
                test: /\.(png|svg|jpg|gif)$/,
                use: [
                    'file-loader'
                ]
            },
            {
                test: /\.html$/,
                loader: 'html-loader'
            }
        ]
    }
};